<?php
/**
 * Description tab
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $woocommerce, $post, $docsku;

        echo '<span style="display:none;">';
        $idsku = the_ID();
        echo '</span>';
	$docsku = get_post_custom($post->ID);
	$documentsku = $docsku['_sku'];
	foreach ( $documentsku as $printsku );

?>

		<h2>Product Documents &amp; Resources</h2>

<ul style="margin-bottom:20px;">
	<li><a href="http://www.siliconsolar.com/publication/silicon-solar-company-brochure/wppa_open">Silicon Solar Company Information Brochure</a></li>
	<li><a href="http://www.siliconsolar.com/publication/sunmaxx-company-information-brochure/wppa_open">SunMaxx Company Information Brochure</a></li>
	<li><a href="http://techvideos.siliconsolar.com" target="_blank">Solar How-To &amp; Troubleshooting Videos</a></li>
    <li><a href="http://www.solarwebinars.com" target="_blank">Interested In Solar Hot Water? Check Out Our Solar Hot Water Training Videos</a></li>
</ul>

<h3 class="widget-title">Product Documents</h3>
<ul>
		<?php

	echo '<span style="display:none;">';
		$skutag = $printsku;
	echo '</span>';

	$args = array(
		'post_type' => 'document',
		'tax_query' => array(
			array(
				'taxonomy' => 'wpdr-file-tags',
				'field' => 'slug',
				'terms' => ''.get_the_ID().''
		)
	)
);
	$productdocs = new WP_Query( $args ); 
			while($productdocs->have_posts()) : 
				$productdocs->the_post(); ?>
			<li><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a></li>
		<?php endwhile ; ?>
        <?php wp_reset_query(); ?>
</ul>

<?php
	$rpproductid = get_the_ID();
	$productprojects = new wp_query('cat=1338&tag='.get_the_ID().'');
        if($productprojects->have_posts()) {
?>

<h3 style='margin-top:10px;'>Used In These Projects</h3>
<ul>
<?php while($productprojects->have_posts()) : $productprojects->the_post(); ?>
	<li><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>

<?php } ?>